package com.test.groovy

/**
 * MethodMadness--GroovyTest
 *
 * @author: Jovi
 *
 * @createTime: 2018-06-11 11:46
 *
 * */
class MethodMadness {

    def repeat(val) {
        for (int i = 0; i < 5; i++) {
            println val
        }
    }

    def repeat1(val) {
        for (i in 0..<5) {
            println(val)
        }
    }

    def repeatDefault(val,repeatDefault = 5) {
        for (i in 0..<repeatDefault) {
            println val
        }
    }

    static void main(args) {
       new MethodMadness().repeat("hello world")
        new MethodMadness().repeat1("hello")
        new MethodMadness().repeatDefault("nihao", 2)
        new MethodMadness().repeatDefault("James")

    }
}
